package spring.boot.notes.jacquesh.event.project.listenters;

import spring.boot.notes.jacquesh.event.project.event.WeatherEvent;

import java.util.ArrayList;

public  abstract class  AbstractEventMultister  implements  EventMulticaster{
	private  ArrayList<WeatherListenter>  listenters=new ArrayList<>();
	@Override
	public void multicastEvent(WeatherEvent weatherEvent) {
      start();
      listenters.forEach(i->i.onWeatherEvent(weatherEvent));
      end();
	}
	@Override
	public void addListenter(WeatherListenter listenter) {
listenters.add(listenter);
	}

	@Override
	public void removeListenter(WeatherListenter listenter) {
		listenters.remove(listenter);
	}
	protected abstract void end();

	protected abstract void start();



}
